#ifndef __Level1_H__
#define __Level1_H__

#include "GameState.h"
#include "components/EnvMapGenerator.h"

class Level1 : public GameState, public RenderTargetListener
{
public:
	void enter();
	void exit();

	void pause();
	void resume();

	bool frameStarted(const Ogre::FrameEvent& evt);
	bool frameEnded(const Ogre::FrameEvent& evt);

	void keyPressed( const OIS::KeyEvent &e );
    void keyReleased( const OIS::KeyEvent &e );

    void mouseMoved( const OIS::MouseEvent &e );
    void mousePressed( const OIS::MouseEvent &e, OIS::MouseButtonID id );
    void mouseReleased( const OIS::MouseEvent &e, OIS::MouseButtonID id );

	static Level1* getInstance() { return &mLevel1; }

	void initBullet();

    void notifyMaterialSetup(uint32 pass_id, MaterialPtr &mat);
    void notifyMaterialRender(uint32 pass_id, MaterialPtr &mat);

protected:
	Level1() { }

	Ogre::Root *mRoot;
	Ogre::SceneManager* mSceneMgr;
	Ogre::Viewport* mViewport;
	Ogre::Camera* mCamera;
    Ogre::Camera* mirrorCamera;


    btDiscreteDynamicsWorld* phyWorld;
//    btDynamicsWorld* phyWorld;

//    lua_State *L;

//    movie_root* gnashRoot;

	MovablePlane* mPlane;
	Entity* mPlaneEnt;
	SceneNode* mPlaneNode;


	bool mExitGame;

    Real timeMulti;

	virtual void createPlane(void);
	virtual void createMirror(void);
	virtual void createCamera(void);
	virtual void createScene(void);

private:
	static Level1 mLevel1;
};

#endif
